home *** CD-ROM | disk | FTP | other *** search
- package classes.game
- {
- import flash.display.*;
- import flash.events.*;
- import flash.text.*;
- import libs.kjc.*;
-
- [Embed(source="/_assets/assets.swf", symbol="classes.game.Panel")]
- public class Panel extends MovieClip
- {
-
- internal static var tom:MovieClip;
-
-
- private var addFrm:Number;
-
- public var poseMc:MovieClip;
-
- private var spd:Number;
-
- private var mFrm:int;
-
- private var msAc:Boolean;
-
- private var id:int;
-
- private var cFrm:Number;
-
- public function Panel()
- {
- super();
- this.gotoAndStop("Point");
- mFrm = this.currentFrame;
- cFrm = 1;
- id = KJC_general.Random(2);
- this.poseMc.gotoAndStop(1 + id);
- msAc = true;
- this.gotoAndStop(1);
- }
-
- internal function setPanel(param1:Number, param2:Number) : void
- {
- addFrm = param1;
- var _loc3_:Number = mFrm / addFrm;
- spd = param2 / _loc3_;
- this.play();
- this.addEventListener(Event.ENTER_FRAME,checkHit);
- }
-
- private function checkHit(param1:Event) : void
- {
- var _loc3_:Boolean = false;
- cFrm += addFrm;
- if(this.poseMc.m0.currentFrame == this.poseMc.m0.totalFrames)
- {
- this.poseMc.m0.gotoAndStop(1);
- this.poseMc.m1.gotoAndStop(1);
- }
- else
- {
- this.poseMc.m0.nextFrame();
- this.poseMc.m1.nextFrame();
- }
- var _loc2_:int = Math.round(cFrm);
- if(_loc2_ > this.totalFrames)
- {
- _loc2_ = this.totalFrames;
- }
- this.gotoAndStop(_loc2_);
- this.x += spd;
- if(msAc == true)
- {
- _loc3_ = Boolean(tom.hit.hitTestObject(this.poseMc.hit));
- if(_loc3_ == true)
- {
- msAc = false;
- if(tom.id == id)
- {
- Game(this.parent).missionSucces(id);
- }
- else
- {
- tom.actionTom("FAIL");
- }
- }
- }
- if(this.currentFrame == this.totalFrames)
- {
- this.removeEventListener(Event.ENTER_FRAME,checkHit);
- this.stop();
- this.parent.removeChild(this);
- }
- else if(this.currentFrame >= mFrm && msAc == false)
- {
- msAc = false;
- this.parent.setChildIndex(this,1);
- }
- }
- }
- }
-